package
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.BlendMode;
	import flash.display.PixelSnapping;
	import flash.display.Sprite;
	import flash.display.Stage;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.filters.BlurFilter;
	import flash.geom.ColorTransform;
	import flash.geom.Matrix;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	import flash.utils.Timer;
	
	import mx.core.FlexBitmap;
	
	[SWF(width="500", height="400", frameRate="30", backgroundColor="#ffffff")]
	
	public class PlayBase extends Sprite
	{
		protected function get random():Number {return Math.random();}
		public function PlayBase()
		{
			super();
			addEventListener(Event.ADDED_TO_STAGE, handleAddedToStage, false, 0, true);
		}
		private function handleAddedToStage(event:Event):void
		{
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;
			removeEventListener(Event.ADDED_TO_STAGE, handleAddedToStage);
			addEventListener(Event.ENTER_FRAME, handleEnterFrame,	false, 0, true);
			trace('		addedToStage');
			addedToStage();
		}
		protected var stageWidth:uint;
		protected var stageHeight:uint;
		private function handleEnterFrame(event:Event):void
		{
			const stage:Stage = this.stage;
			const stageWidth:uint = stage.stageWidth; 
			const stageHeight:uint = stage.stageHeight;
			if (stageWidth != this.stageWidth  || stageHeight != this.stageHeight)
			{
				resized(stageWidth,stageHeight);
				trace('		resized', stageWidth,stageHeight);
				this.stageWidth = stageWidth;
				this.stageHeight = stageHeight;
			}
			enterFrame();
		}
		protected function addedToStage():void{}
		protected function enterFrame():void{}
		protected function resized(width:uint, height:uint):void{}
	}
}